package com.cloud.feeling.ststem.service.impl;

import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import com.cloud.common.model.Menu;
import com.cloud.feeling.ststem.mapper.MenuMapper;
import com.cloud.feeling.ststem.service.MenuService;

@Service
public class MenuServiceImpl implements MenuService {
	
	@Autowired
	MenuMapper menuMapper;

	@Override
	public List<Menu> getMenuList(Integer id) {
		List<Menu> menu = menuMapper.getDepparByPid(-1);
		return menuMapper.getDepparByPid(-1);
	}

	@Override
	public List<Menu> selectByMenu(Menu menu) {
		return menuMapper.selectByMenu(menu);
	}

	@Override
	public void saveMenu(Menu menu) {
		if(menu!=null&&menu.getId()!=null) {
			menuMapper.updateMenu(menu);
		}else {
			menuMapper.saveMenu(menu);
		}
	}

	@Override
	public void deleteMenu(Integer id) {
		menuMapper.deleteMenu(id);
	}

}
